gtktoolitem: Remove gtk_tool_item_set_use_drag_window()
authorCarlos Garnacho <carlosg@gnome.org>
Sun, 2 Apr 2017 14:41:44 +0000 (16:41 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Thu, 25 May 2017 14:25:59 +0000 (16:25 +0200)
This API call is not necessary anymore, since it's no longer necessary
to receive events.

docs/reference/gtk/gtk4-sections.txt
gtk/gtktoolitem.c
gtk/gtktoolitem.h

index 37411304463b44283756f2d7bea875511930fa5e..28ce71076b0e6334d1ccd0669fbdb24b5591a38e 100644 (file)
@@ -3271,8 +3271,6 @@ gtk_tool_item_set_expand
 gtk_tool_item_get_expand
 gtk_tool_item_set_tooltip_text
 gtk_tool_item_set_tooltip_markup
-gtk_tool_item_set_use_drag_window
-gtk_tool_item_get_use_drag_window
 gtk_tool_item_set_visible_horizontal
 gtk_tool_item_get_visible_horizontal
 gtk_tool_item_set_visible_vertical
index 666ef4bd3dd6054dbd9190919a0aaaa50d5e0bf3..2365af8fc0a7253d356bd31b2b5ec42b494be48e 100644 (file)
@@ -80,10 +80,8 @@ struct _GtkToolItemPrivate
   guint visible_vertical      : 1;
   guint homogeneous           : 1;
   guint expand                : 1;
-  guint use_drag_window       : 1;
   guint is_important          : 1;
 
-  GdkWindow *drag_window;
   gchar *menu_item_id;
   GtkWidget *menu_item;
 };
@@ -101,10 +99,6 @@ static void gtk_tool_item_get_property (GObject         *object,
                                        GParamSpec      *pspec);
 static void gtk_tool_item_property_notify (GObject      *object,
                                           GParamSpec   *pspec);
-static void gtk_tool_item_realize       (GtkWidget      *widget);
-static void gtk_tool_item_unrealize     (GtkWidget      *widget);
-static void gtk_tool_item_map           (GtkWidget      *widget);
-static void gtk_tool_item_unmap         (GtkWidget      *widget);
 static void gtk_tool_item_size_allocate (GtkWidget      *widget,
                                         GtkAllocation  *allocation);
 
@@ -127,10 +121,6 @@ gtk_tool_item_class_init (GtkToolItemClass *klass)
   object_class->finalize     = gtk_tool_item_finalize;
   object_class->notify       = gtk_tool_item_property_notify;
 
-  widget_class->realize       = gtk_tool_item_realize;
-  widget_class->unrealize     = gtk_tool_item_unrealize;
-  widget_class->map           = gtk_tool_item_map;
-  widget_class->unmap         = gtk_tool_item_unmap;
   widget_class->size_allocate = gtk_tool_item_size_allocate;
   widget_class->parent_set    = gtk_tool_item_parent_set;
 
@@ -315,97 +305,15 @@ gtk_tool_item_property_notify (GObject    *object,
     G_OBJECT_CLASS (gtk_tool_item_parent_class)->notify (object, pspec);
 }
 
-static void
-create_drag_window (GtkToolItem *toolitem)
-{
-  GtkAllocation allocation;
-  GtkWidget *widget;
-
-  g_return_if_fail (toolitem->priv->use_drag_window == TRUE);
-
-  widget = GTK_WIDGET (toolitem);
-
-  gtk_widget_get_allocation (widget, &allocation);
-
-  toolitem->priv->drag_window = gdk_window_new_input (gtk_widget_get_parent_window (widget),
-                                                      GDK_ALL_EVENTS_MASK,
-                                                      &allocation);
-  gtk_widget_register_window (widget, toolitem->priv->drag_window);
-}
-
-static void
-gtk_tool_item_realize (GtkWidget *widget)
-{
-  GtkToolItem *toolitem = GTK_TOOL_ITEM (widget);
-
-  GTK_WIDGET_CLASS (gtk_tool_item_parent_class)->realize (widget);
-
-  if (toolitem->priv->use_drag_window)
-    create_drag_window(toolitem);
-}
-
-static void
-destroy_drag_window (GtkToolItem *toolitem)
-{
-  if (toolitem->priv->drag_window)
-    {
-      gtk_widget_unregister_window (GTK_WIDGET (toolitem), toolitem->priv->drag_window);
-      gdk_window_destroy (toolitem->priv->drag_window);
-      toolitem->priv->drag_window = NULL;
-    }
-}
-
-static void
-gtk_tool_item_unrealize (GtkWidget *widget)
-{
-  GtkToolItem *toolitem;
-
-  toolitem = GTK_TOOL_ITEM (widget);
-
-  destroy_drag_window (toolitem);
-  
-  GTK_WIDGET_CLASS (gtk_tool_item_parent_class)->unrealize (widget);
-}
-
-static void
-gtk_tool_item_map (GtkWidget *widget)
-{
-  GtkToolItem *toolitem;
-
-  toolitem = GTK_TOOL_ITEM (widget);
-  GTK_WIDGET_CLASS (gtk_tool_item_parent_class)->map (widget);
-  if (toolitem->priv->drag_window)
-    gdk_window_show (toolitem->priv->drag_window);
-}
-
-static void
-gtk_tool_item_unmap (GtkWidget *widget)
-{
-  GtkToolItem *toolitem;
-
-  toolitem = GTK_TOOL_ITEM (widget);
-  if (toolitem->priv->drag_window)
-    gdk_window_hide (toolitem->priv->drag_window);
-  GTK_WIDGET_CLASS (gtk_tool_item_parent_class)->unmap (widget);
-}
-
 static void
 gtk_tool_item_size_allocate (GtkWidget     *widget,
                             GtkAllocation *allocation)
 {
-  GtkToolItem *toolitem = GTK_TOOL_ITEM (widget);
   GtkAllocation child_allocation;
   GtkWidget *child;
 
   gtk_widget_set_allocation (widget, allocation);
 
-  if (toolitem->priv->drag_window)
-    gdk_window_move_resize (toolitem->priv->drag_window,
-                            allocation->x,
-                            allocation->y,
-                            allocation->width,
-                            allocation->height);
-
   child = gtk_bin_get_child (GTK_BIN (widget));
   if (child && gtk_widget_get_visible (child))
     {
@@ -831,66 +739,6 @@ gtk_tool_item_set_tooltip_markup (GtkToolItem *tool_item,
     gtk_widget_set_tooltip_markup (child, markup);
 }
 
-/**
- * gtk_tool_item_set_use_drag_window:
- * @tool_item: a #GtkToolItem 
- * @use_drag_window: Whether @tool_item has a drag window.
- * 
- * Sets whether @tool_item has a drag window. When %TRUE the
- * toolitem can be used as a drag source through gtk_drag_source_set().
- * When @tool_item has a drag window it will intercept all events,
- * even those that would otherwise be sent to a child of @tool_item.
- * 
- * Since: 2.4
- **/
-void
-gtk_tool_item_set_use_drag_window (GtkToolItem *toolitem,
-                                  gboolean     use_drag_window)
-{
-  g_return_if_fail (GTK_IS_TOOL_ITEM (toolitem));
-
-  use_drag_window = use_drag_window != FALSE;
-
-  if (toolitem->priv->use_drag_window != use_drag_window)
-    {
-      toolitem->priv->use_drag_window = use_drag_window;
-      
-      if (use_drag_window)
-       {
-         if (!toolitem->priv->drag_window &&
-              gtk_widget_get_realized (GTK_WIDGET (toolitem)))
-           {
-             create_drag_window(toolitem);
-             if (gtk_widget_get_mapped (GTK_WIDGET (toolitem)))
-               gdk_window_show (toolitem->priv->drag_window);
-           }
-       }
-      else
-       {
-         destroy_drag_window (toolitem);
-       }
-    }
-}
-
-/**
- * gtk_tool_item_get_use_drag_window:
- * @tool_item: a #GtkToolItem 
- * 
- * Returns whether @tool_item has a drag window. See
- * gtk_tool_item_set_use_drag_window().
- * 
- * Returns: %TRUE if @tool_item uses a drag window.
- * 
- * Since: 2.4
- **/
-gboolean
-gtk_tool_item_get_use_drag_window (GtkToolItem *toolitem)
-{
-  g_return_val_if_fail (GTK_IS_TOOL_ITEM (toolitem), FALSE);
-
-  return toolitem->priv->use_drag_window;
-}
-
 /**
  * gtk_tool_item_set_visible_horizontal:
  * @tool_item: a #GtkToolItem
@@ -1140,9 +988,6 @@ gtk_tool_item_toolbar_reconfigured (GtkToolItem *tool_item)
   g_return_if_fail (GTK_IS_TOOL_ITEM (tool_item));
 
   g_signal_emit (tool_item, toolitem_signals[TOOLBAR_RECONFIGURED], 0);
-  
-  if (tool_item->priv->drag_window)
-    gdk_window_raise (tool_item->priv->drag_window);
 
   gtk_widget_queue_resize (GTK_WIDGET (tool_item));
 }
index 9a24c8813e497e64b11419284df6c397e405b50e..e17a8925c2d9bd175dbfa45a83dfc16e123aa4fd 100644 (file)
@@ -99,13 +99,6 @@ void            gtk_tool_item_set_tooltip_text         (GtkToolItem *tool_item,
 GDK_AVAILABLE_IN_ALL
 void            gtk_tool_item_set_tooltip_markup       (GtkToolItem *tool_item,
                                                        const gchar *markup);
-
-GDK_AVAILABLE_IN_ALL
-void            gtk_tool_item_set_use_drag_window      (GtkToolItem *tool_item,
-                                                       gboolean     use_drag_window);
-GDK_AVAILABLE_IN_ALL
-gboolean        gtk_tool_item_get_use_drag_window      (GtkToolItem *tool_item);
-
 GDK_AVAILABLE_IN_ALL
 void            gtk_tool_item_set_visible_horizontal   (GtkToolItem *tool_item,
                                                        gboolean     visible_horizontal);